package collection;

import java.util.ArrayList;

public class ArrayListMain {
	
	public static void main(String[] args) {
		
		ArrayList list = new ArrayList();
		
		list.add(new String("거북이"));
		list.add(new Float(3.141592f));
		list.add("토끼");
		
		for (int i = 0 ; i < list.size() ; i++ ) {
			System.out.println(i + "번 위치:" +
					list.get(i));
		}
		
		Object[] listArray = list.toArray();
		
		System.out.println("listArray.length: " +
				listArray.length);
		
		for (int i = 0; i < listArray.length; i++) {
			System.out.println("listArray[" + i + "]: " +
					listArray[i]);
		}
		
		System.out.println("거북이 위치: " +
				list.indexOf("거북이"));
		System.out.println("토끼 위치: " +
				list.indexOf("토끼"));
		
	}
	
}
